<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var z=/^(\d+,)*\d+$/
        function f() {
            var value = document.getElementById("zfc").value;
            var arr=new Array();
            if (z.test(value)){
                var strings = value.split(",");
                for (var i=0;i<strings.length;i++){
                   if (strings[i]%2==0){
                       arr.push(strings[i]);
                   }
                }
                document.getElementById("nzfc").value="["+arr+"]";
            }else {
                document.getElementById("nzfc").value="";
                alert("输入错误,请重新输入! ! !");
            }
        }
    </script>
</head>
<body>
字符串数组格式:(2,3,1,3,6):
<input id="zfc" type="text"/>
<br/>
<input type="button" value="开始查找" onclick="f()"/>
<br/>
<input id="nzfc" type="text"/>
</body>
</html>